<template>
    <div class="update">    
        <van-cell-group>
            <van-field
                v-model="username"
                label="用户名"
                left-icon="contact"
            />
        </van-cell-group>   
        <!-- btn -->
        <van-button size="large" type="primary" class="save" @click="rename">确认修改</van-button>
    </div>
</template>

<script>
export default {
    data() {
        return {
            username: ''
        }
    },
    methods: {
        rename() {   
            this.$store.state.user.name = this.username
            this.$router.push({path: '/user/userInfo'})
        }
    }
}
</script>

<style lang="less" scoped>

</style>
